package com.xiaren.ui;

import java.awt.BorderLayout;
import java.awt.Color;
import java.awt.event.ComponentEvent;

import javax.swing.JButton;
import javax.swing.JPanel;
import javax.swing.JScrollPane;
import javax.swing.JTabbedPane;
import javax.swing.SwingConstants;

import com.xiaren.common.IConstant;
import com.xiaren.common.ObjectConstant;
import com.xiaren.ui.tree.JTreeBiz;

/**

 * @主页 http://www.leaf123.cn/
 * @邮箱 xia5523@qq.com
 */
public class LeftJPanel extends JPanel implements ComResizedListener {

	public JTabbedPane tp = new JTabbedPane(SwingConstants.BOTTOM);
	public JScrollPane jsp = new JScrollPane();
	public  MainJPanel mainPanel = null;

	public LeftJPanel(MainJPanel mainPanel) {
		super();
		this.mainPanel = mainPanel;
	}

	void initCommpent() {
		new JTreeBiz();
		this.setLayout(new BorderLayout());
		JPanel panelOne = new JPanel();
		JPanel panelTwo = new JPanel();


		panelOne.add(ObjectConstant.mainTree);

		panelTwo.add(new JButton("当前选中的是第2个选项卡"));

		tp.add(panelOne, "目录");
		tp.add(panelTwo, "索引");

		jsp.setViewportView(tp);
		jsp.setHorizontalScrollBarPolicy(JScrollPane.HORIZONTAL_SCROLLBAR_AS_NEEDED);
		this.add(jsp, BorderLayout.CENTER);

//		this.setBackground(Color.LIGHT_GRAY);
	}

	void init() {
		initCommpent();
		ObjectConstant.leftPanel = this;

	}



	@Override
	public void resized(ComponentEvent e) {
		this.setSize(IConstant.LEFTPANEL_WIDTH, e.getComponent().getHeight()
				- IConstant.TOOLBAR_HEIGHT);
	}






}
